/**
 * @author Jordan Barroga
 * @author Reed Pasatiempo
 */

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

public class SettingsMenu implements ActionListener 
{

	static Settings temp = new Settings();
	
	public static void createGUI()
	{
		// JFrame Settings
		JFrame frame = new JFrame("Settings Menu");
		frame.setSize(500, 600);
		frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);
		frame.setVisible(true);

		// Main Panel
		JPanel main = new JPanel();
		// Lower Panel
		JPanel exit = new JPanel();
		
		// Tabbed Pane
		JTabbedPane menu = new JTabbedPane();
		main.add(menu);
		
		// Tabbed Panels
		JPanel snake = new JPanel();
		snake.setSize(300,400);
		JPanel board = new JPanel();
		board.setSize(300, 400);
		JPanel bg = new JPanel();
		bg.setSize(300, 400);
		
		
		// Tabbed Menu
		menu.addTab("Snake", snake);
		menu.addTab("Board", board);
		JPanel bgPanel = new JPanel(new GridLayout(0, 1));
		menu.add(bgPanel);
		bgPanel.setSize(300, 400);
		menu.addTab("Background", bgPanel);
		
		//====================================================================================
		//
		//					TABBED SNAKE
		//
		//====================================================================================


		
		//====================================================================================
		//
		//					TABBED BOARD
		//
		//====================================================================================
		
		
		
		//====================================================================================
		//
		//					TABBED BACKGROUND
		//
		//====================================================================================

		// GOTTA "setMnemonic" and "setActionCommand"
		JRadioButton cyan = new JRadioButton("Cyan");
		cyan.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{ 
				temp.setBackground(1); 
			}
		});
		JRadioButton blue = new JRadioButton("Blue");
		blue.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(2);
			}
		});
		JRadioButton darkGray = new JRadioButton("Dark Gray");
		darkGray.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(3);
			}
		});
		JRadioButton gray = new JRadioButton("Gray");
		gray.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(4);
			}
		});
		JRadioButton green = new JRadioButton("Green");
		green.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(4);
			}
		});
		JRadioButton lightGray = new JRadioButton("Light Gray");
		lightGray.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(5);
			}
		});
		JRadioButton magenta = new JRadioButton("Magenta");
		magenta.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(6);
			}
		});
		JRadioButton orange = new JRadioButton("Orange");
		orange.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(7);
			}
		});
		JRadioButton pink = new JRadioButton("Pink");
		pink.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(8);
			}
		});
		JRadioButton red = new JRadioButton("Red");
		red.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(9);
			}
		});
		JRadioButton white = new JRadioButton("White");
		white.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(10);
			}
		});
		JRadioButton yellow = new JRadioButton("Yellow");
		yellow.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(11);
			}
		});
		JRadioButton black = new JRadioButton("Black");
		black.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				temp.setBackground(12);
			}
		});
		black.setSelected(true);
		
		// adding to groups keeps multiples from being checked
		ButtonGroup bgGroup = new ButtonGroup();
		bgGroup.add(cyan);
		bgGroup.add(blue);
		bgGroup.add(darkGray);
		bgGroup.add(gray);
		bgGroup.add(green);
		bgGroup.add(lightGray);
		bgGroup.add(magenta);
		bgGroup.add(orange);
		bgGroup.add(pink);
		bgGroup.add(red);
		bgGroup.add(white);
		bgGroup.add(yellow);
		bgGroup.add(black);
		
		// adding them to the panel
		bgPanel.add(cyan);
		bgPanel.add(blue);
		bgPanel.add(darkGray);
		bgPanel.add(gray);
		bgPanel.add(green);
		bgPanel.add(lightGray);
		bgPanel.add(magenta);
		bgPanel.add(orange);
		bgPanel.add(pink);
		bgPanel.add(red);
		bgPanel.add(white);
		bgPanel.add(yellow);
		bgPanel.add(black);
		
		//====================================================================================
		//
		//					EXIT PANEL
		//
		//====================================================================================

		JButton save = new JButton("Save Changes");
		JButton undo = new JButton("Undo Changes");
		JButton def = new JButton("Default");
		JButton leave = new JButton("Exit");
		
		exit.add(save);
		exit.add(undo);
		exit.add(def);
		exit.add(leave);
		
		frame.add(main);
//		frame.add(exit);
	}
	
	public Settings returnSettings()
	{
		return temp;
	}

}
